package com.yimu.unknow;

/**
 * @Author YiMu
 * @Date 2020/10/27 21:33
 * @Description
 */
public class B {
    public void testReplace(){
        String str ="hello word !!";
        System.out.println("替换之前 :{}"+str);
        str = str.replace('a','b');
        str = str.replace("a","b");
        System.out.println("替换所有字符 :{}"+str);
        str = str.replaceAll("a","b");
        System.out.println("替换全部 :{}"+str);
        str = str.replaceFirst("l","");
        System.out.println("替换第一个 l :{}"+str);
    }
}
